#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>

void cb(sensor_msgs::LaserScan msg)
{
    ROS_INFO("%f", msg.ranges[180]);
}

int main(int argc, char** argv)
{
    ros::init(argc, argv, "laser");
    ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe("/scan", 10, cb);

    while (ros::ok()) {
        ros::spinOnce();
    }

    return 0;
}